Skip to contentSkip to conversation

static nat with iptables

DISCUSSION zeinali 2 participants 2 messages Feb 22, 2004

lore
Share & tools
lore

zeinali

author
#0 lore raw

Dear sir

Pls kindly help me

I have a private address like 192.168.20.19/24 and I have a public address like 213.29.76.153/27 im going to translate (STATIC NAT) my private ip address to public address (213.29.76.19) with iptables

Meanwhile my router is redhat linux 8.0 and have 2 network adapter like below

Eth0 192.168.20.1 /24 (connect to private network)

Eth1 213.29.76.154 /27 (connected to internet )

Many Thanks&Best Regards

Behnam Zeinali

Internet Dept.

www.maadiran.com <http://www.maadiran.com/>

#1 lore raw

is your eth0 ip address a static ip or dynamic? if it is static try this:

iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED, RELATED -j ACCEPT iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -A FORWARD -j LOG

iptables -t nat -A POSTROUTING -s 192.168.20.0/24 -o eth1 -j SNAT --to 213.29.76.153

Dear sir

Pls kindly help me

I have a private address like 192.168.20.19/24 and I have a public address like 213.29.76.153/27 im going to translate (STATIC NAT) my private ip address to public address (213.29.76.19) with iptables

Meanwhile my router is redhat linux 8.0 and have 2 network adapter like below

Eth0 192.168.20.1 /24 (connect to private network)

Eth1 213.29.76.154 /27 (connected to internet )